//
//  BVWebViewController.m
//  TakingTreasure1
//
//  Created by YYKJ on 2017/5/13.
//  Copyright © 2017年 YYKJ. All rights reserved.
//

#import "BVNewFeatureCell.h"
#import "BVTabBarController.h"
#import "UIView+TransitionAnimation.h"

@interface BVNewFeatureCell()

@property (nonatomic, strong) UIImageView   *imageView;
@property (nonatomic, strong) UIButton      *startBtn;
@property (nonatomic, strong) UIButton      *skipBtn;

@end

@implementation BVNewFeatureCell

- (void)setImages:(UIImage *)images {
    _images = images;
    self.imageView.image = images;
}

- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc] init];
        _imageView.frame = self.bounds;
        [self.contentView addSubview:_imageView];
    }
    return _imageView;
}

- (UIButton *)skipBtn{
    if (!_skipBtn) {
        _skipBtn = [[UIButton alloc]init];
        _skipBtn.frame = CGRectMake(ScreenW-60, 50, 40, 30);
        [_skipBtn setTitle:@"跳过" forState:UIControlStateNormal];
        [_skipBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _skipBtn.backgroundColor = [UIColor colorWithRed:223/255.0 green:129/255.0 blue:159/255.0 alpha:0.5];
        [_skipBtn addTarget:self action:@selector(startJingCaiClick) forControlEvents:UIControlEventTouchUpInside];
        _skipBtn.layer.cornerRadius = 8.0;
        _skipBtn.layer.masksToBounds = YES;
    }
    return _skipBtn;
}

- (UIButton *)startBtn {
    if (!_startBtn) {
        _startBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.contentView addSubview:_startBtn];
        _startBtn.frame = CGRectMake(120, ScreenH - 100, ScreenW - 200, 40);
        [_startBtn setTitle:@"打开相豫" forState:UIControlStateNormal];
        [_startBtn addTarget:self action:@selector(startJingCaiClick) forControlEvents:UIControlEventTouchUpInside];
        _startBtn.titleLabel.font = [UIFont systemFontOfSize:16];
        _startBtn.layer.cornerRadius = 10.0;
        _startBtn.layer.masksToBounds = YES;
        _startBtn.layer.borderColor = [UIColor redColor].CGColor;
        _startBtn.layer.borderWidth = 0.5;
    }
    return _startBtn;
}


- (void)setIndexPath:(NSIndexPath *)indexPath index:(NSInteger)index {
    if (indexPath.row == index - 1) {
        self.startBtn.hidden = NO;
    }else{
        self.startBtn.hidden = YES;
    }
}

#pragma mark -
#pragma mark - startButtonClick
- (void)startJingCaiClick {
    
    BVTabBarController *idnexVC = [[BVTabBarController alloc] init];
    [BVKeyWindow addTransitionAnimationWithDuration:1.0f type:TransitionRippleEffect subType:FROM_BOTTOM];
    BVKeyWindow.rootViewController = idnexVC;

}

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

@end
